package com.bean.controller;

import com.bean.service.StuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.annotation.Resource;

@ApiIgnore
@RestController
public class StuFooController {

    @Autowired
    private StuService stuService;

    @GetMapping("/getStu")
    public Object getStu(Integer id) {
        return stuService.getStuInfo(id);
    }

    @PostMapping("/saveStu")
    public String saveStu() {
        stuService.saveStu();
        return "ok";
    }

    @PostMapping("/updateStu")
    public String updateStu(Integer id) {
        System.out.println(id);
        stuService.updateStu(id);
        return "ok";
    }

    @PostMapping("/deleteStu")
    public String deleteStu(Integer id) {
        stuService.deleteStu(id);
        return "ok";
    }

}
